<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%
	String path = request.getContextPath();
	// 获得本项目的地址(例如: http://localhost:8080/MyApp/)赋值给basePath变量 
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	// 将 "项目路径basePath" 放入pageContext中，待以后用EL表达式读出。 
	pageContext.setAttribute("basePath", basePath);
	//out.write(basePath);
%>

<!-- Bootstrap core CSS -->
<link href="<%=basePath%>bootstrap3/css/bootstrap.min.css"
	rel="stylesheet">
<link href="data:text/css;charset=utf-8,"
	data-href="<%=basePath%>bootstrap3/css/bootstrap-theme.min.css"
	rel="stylesheet" id="bs-theme-stylesheet">
<link href="<%=basePath%>bootstrap3/css/docs.min.css" rel="stylesheet">

<script src="<%=basePath%>bootstrap3/js/jquery.min.js"></script>

<script src="<%=basePath%>bootstrap3/js/bootstrap.min.js"></script>

<script src="<%=basePath%>bootstrap3/js/docs.min.js"></script>

<script src="<%=basePath%>bootstrap3/js/ie10-viewport-bug-workaround.js"></script>
<style type="text/css">
#head {
	height: 100px;
	width: 100%;
	background: #398439;
	margin-left: auto;
	margin-right: auto;
}
</style>
<script>
	$(function() {
		var addo = $("#modifyPsw")[0].value;
		if (addo != null && addo != "") {
			alert(addo);
		}
	});
	function checkNew() {
		var txtPsw = document.getElementById("newPsw").value;
		var sptxtPsw = document.getElementById("spannewPsw");
		var txtOldPsw = document.getElementById("oldPsw").value;
		if (txtPsw == null || txtPsw == ""||txtOldPsw==txtPsw) {
			sptxtPsw.innerHTML = "新的密码不能为空或者与当前密码相同~";
			sptxtPsw.style.color = "#B92C28";
			return false;
		} else {
			sptxtPsw.innerHTML = "";
			return true;
		}
	}

	function checkPswTrue() {
		var txtPswNow = document.getElementById("newPswTr").value;
		var txtPswBefor = document.getElementById("newPsw").value;
		var sptxtPsw = document.getElementById("spannewPswTr");
		if (txtPswNow != txtPswBefor || txtPswNow == null || txtPswNow == "") {
			sptxtPsw.innerHTML = "新的密码必须保持一致~";
			sptxtPsw.style.color = "#B92C28";
			return false;
		} else {
			sptxtPsw.innerHTML = "";
			return true;
		}
	}

	function checkOldPsw() {
		var txtPswNow = document.getElementById("oldPsw").value;
		var sptxtPsw = document.getElementById("spanoldPsw");
		if (txtPswNow == null || txtPswNow == "") {
			sptxtPsw.innerHTML = "当前密码不能为空~";
			sptxtPsw.style.color = "#B92C28";
			return false;
		} else {
			sptxtPsw.innerHTML = "";
			return true;
		}
	}

	function checkall() {
		var old = checkOldPsw();
		var new1 = checkNew();
		var new2 = checkPswTrue();
		if (old && new1 && new2) {
			return true;
		} else {
			return false;
		}
	}
</script>
</head>

<body>
	<input type="hidden" id="modifyPsw" value="${sessionScope.modifyPsw }">
	<div id="head">
		<div style="height: 10px;"></div>
		<div
			style="height: 100px; width: 60%; margin-left: auto; margin-right: auto;">
			<font size="5" color="#B1B1B1">
				<h1>
					<span class="glyphicon glyphicon-cutlery"></span>&nbsp;&nbsp;&nbsp;&nbsp;修&nbsp;改&nbsp;密&nbsp;码
				</h1>
			</font>
		</div>
	</div>
	<div style="height: 30px;"></div>
	<form class="form-horizontal"
		action="<%=basePath%>netuser/usermodifyPaw.action">
		<div class="form-group">
			<div class="col-md-1"></div>
			<label for="inputEmail3" class="col-md-2 control-label"><font
				size="5">当前密码:</font></label>
			<div class="col-md-3">
				<input type="password" class="form-control" id="oldPsw"
					name="oldPsw" placeholder="请输入当前密码" onblur="checkOldPsw();"
					style="height: 40px;">
			</div>
			<div class="col-md-3">
				<span id="spanoldPsw"></span>
			</div>
		</div>
		<hr />
		<div class="form-group">
			<div class="col-md-1"></div>
			<label for="inputPassword3" class="col-md-2 control-label"><font
				size="5">新的密码:</font></label>
			<div class="col-md-3">
				<input type="password" class="form-control" id="newPsw"
					name="newPsw" placeholder="请输入新的密码" onblur="checkNew();"
					style="height: 40px;">
			</div>
			<div class="col-md-3">
				<span id="spannewPsw"></span>
			</div>
		</div>
		<hr />
		<div class="form-group">
			<div class="col-md-1"></div>
			<label for="inputPassword3" class="col-md-2 control-label"><font
				size="5">新的密码:</font></label>
			<div class="col-md-3">
				<input type="password" class="form-control" id="newPswTr"
					name="newPswTr" placeholder="请确定新的密码" onblur="checkPswTrue();"
					style="height: 40px;">
			</div>
			<div class="col-md-3">
				<span id="spannewPswTr"></span>
			</div>
		</div>
		<hr />
		<div class="row">
			<div class="col-md-3"></div>
			<button type="submit" class="btn btn-success"
				onclick="return checkall();">提&nbsp;&nbsp;交</button>
		</div>
	</form>

</body>

</html>